/**
 * 01/feb/2013
 * Donaciano Ugalde Peñaloza 
 */
function limpiar() {
	document.getElementById('nombre').value = "";
	document.getElementById('telefono').value = "";
	document.getElementById('email').value = "";
	document.getElementById('mensaje').value = "";
	document.getElementById('spanNombre').style.visibility = "hidden";
	document.getElementById('spanTelefono').style.visibility = "hidden";
	document.getElementById('spanEmail').style.visibility = "hidden";
	document.getElementById('spanMensaje').style.visibility = "hidden";
	document.getElementById('spanCorreoExito').style.visibility = "hidden";
	document.getElementById('spanCorreoError').style.visibility = "hidden";
}

/**
 * 04/feb/2013
 * Donaciano Ugalde Peñaloza
 */
function mostrarMensajeCorreo(exitoso) {
	if (exitoso) {
		document.getElementById('spanCorreoExito').style.visibility = "";
		document.getElementById('spanCorreoError').style.visibility = "hidden";
	} else {
		document.getElementById('spanCorreoExito').style.visibility = "hidden";
		document.getElementById('spanCorreoError').style.visibility = "";
	}
}

/**
 * 01/feb/2013
 * Donaciano Ugalde Peñaloza 
 */
function hacerSubmit() {
	if (validar()) {
		document.forms['formContacto'].submit();
	}
}

/**
 * 01/feb/2013
 * Donaciano Ugalde Peñaloza 
 */
function validar() {
	var todoBien = true;
	var nombre = document.getElementById('nombre').value;
	var telefono = document.getElementById('telefono').value;
	var email = document.getElementById('email').value;
	var mensaje = document.getElementById('mensaje').value;
	if (nombre.length < 1) {
		document.getElementById('spanNombre').style.visibility = "";
		todoBien = false;
	} else {
		document.getElementById('spanNombre').style.visibility = "hidden";
	}
	if (telefono.length < 1) {
		document.getElementById('spanTelefono').style.visibility = "";
		todoBien = false;
	} else {
		document.getElementById('spanTelefono').style.visibility = "hidden";
	}
	if (email.length < 1) {
		document.getElementById('spanEmail').style.visibility = "";
		todoBien = false;
	} else {
		document.getElementById('spanEmail').style.visibility = "hidden";
	}
	if (mensaje.length < 1) {
		document.getElementById('spanMensaje').style.visibility = "";
		todoBien = false;
	} else {
		document.getElementById('spanMensaje').style.visibility = "hidden";
	}
	return todoBien;
}
